<template>

    <div>
        账号：<input type="text" name="" id="" v-model="username" @blur="checkusername"><br>
        密码：<input type="password" name="" id="" v-model="password" @blur="checkpassword"><br>
        <button @click="login">登录</button>
    </div>
</template>

<script>
import {get, post} from '../../utils/request'
export default {
    name:'rigister',
    data(){
        return{
            username:'',
            password:'',
        }
    }, 
    methods:{
        login(){
            post('http://127.0.0.1:8000/user/login/',{password:this.password,username:this.username}).then(res=>{
                if(res.data.code==200){
                    alert(res.data.msg)
                    this.$router.push('/Department')
                }else{
                    alert(res.data.msg)                    
                }
            }
            ).catch(err=>{
                console.log(err)
            })
        }
    }
}
</script>

<style>

</style>